begin tran
declare @datefr datetime, @datefrstr nvarchar(10), @dateto datetime, @shop_code nvarchar(20)
select @shop_code = 'kohm'
select @datefr = '2015.07.01', @dateto = last_dayend from pos_shop where shop_code = @shop_code
select * from  pos_shop where shop_code = @shop_code
 
while(@datefr<=@dateto)
begin
select @datefrstr = convert(nvarchar(10), @datefr, 102)
exec sp_pos_st_dayend @shop_code, @datefrstr, 1
select @datefr = dateadd(day, 1, @datefr)
end 
select * from pos_st_daily_bal a
 where  shop_code ='kohm' and  sku = '6958988080924       '
order by 2
rollback tran

 
/*
select * from pos_sales_hdr a, pos_sales_dtl b
 where trx_date = '2013.03.26' and shop_code ='kohm' and a.trx_no = b.trx_no

select * from pos_st_daily_bal where trx_date = '2013.03.25' and shop_code ='kohm'
select * from igsnet.dbo.dc_pick_hdr where  pick_no ='KO-IS0021303'
select * from fg_st_ctrl where sku = '6958988002414'
update fg_st_ctrl set bin_loca ='IN' ,pick_no = '' where sku = '6958988002414'

*/